package com.sora.model.vo;

import com.sora.enums.ResultCode;
import lombok.Getter;
import lombok.ToString;

@Getter
@ToString
public class ResultVO<T> {

    private int code;

    private String msg;

    private T data;

    public ResultVO() {
        this.code = ResultCode.SUCCESS.getCode();
        this.msg = ResultCode.SUCCESS.getMsg();
        this.data = null;
    }

    public ResultVO(T data) {
        this.code = ResultCode.SUCCESS.getCode();
        this.msg = ResultCode.SUCCESS.getMsg();
        this.data = data;
    }

    public ResultVO(ResultCode resultCode) {
        this.code = resultCode.getCode();
        this.msg = resultCode.getMsg();
        this.data = null;
    }

    public ResultVO(ResultCode resultCode, T data) {
        this.code = resultCode.getCode();
        this.msg = resultCode.getMsg();
        this.data = data;
    }
}
